package at.home.project.login.view;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class newScreen {
	
	private JFrame appFrame;

	public newScreen(String ScreenName) {
		appFrame = new JFrame();
		appFrame.setTitle(ScreenName);
	}
	
	public void startApp() {
		
		appFrame.setSize(600, 600);
		appFrame.setLocationRelativeTo(null);
		appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		JPanel mainPanel = new JPanel();
		GridBagLayout gridBagLayout = new GridBagLayout();
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
		gridBagConstraints.insets = new Insets(5,5,5,5);
		mainPanel.setLayout(gridBagLayout);
		mainPanel.setBorder(BorderFactory.createTitledBorder(appFrame.getTitle()));
		
		{
			JButton button = new JButton("App.Com");
			button.setBorderPainted(true);
//			button.setBounds(5, 5, 60, 20);
			gridBagConstraints.gridx = 5;
			gridBagConstraints.gridy = 7;
			button.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					button.setText("Tiklandi");
				}
			});
			mainPanel.add(button,gridBagConstraints);
		}
		

		appFrame.add(mainPanel);
		appFrame.setVisible(true);
	}
}
